﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;

namespace EducationManagementSystem.Admin
{
    public partial class TotalStuFee : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Bind();
            }
        }

        private void Bind()
        {

            SqlConnection conn = DB.Conn();
            conn.Open();
            string sql = "select sum(money) as 收费总金额,d.schoolname as 学院名称 from fee a,student b,class c,school d where a.stuid=b.stuid and b.classid =c.classid and c.schoolid=d.schoolid group by d.schoolid,d.schoolname";
            SqlCommand cmd = new SqlCommand(sql, conn);
            DataSet ds = new DataSet();
            SqlDataAdapter sda = new SqlDataAdapter(cmd);
            sda.Fill(ds);
            //GridView1.DataSource = ds.Tables[0];
            //GridView1.DataBind();
            DataGrid1.DataSource = ds.Tables[0];
            DataGrid1.DataBind();
        }
    }
}